import { createApp } from "vue";
import router from "@/router/index";
import { createPinia } from "pinia";
import App from "./App.vue";
const app = createApp(App);

import ElementPlus from "element-plus";
import zhCn from "element-plus/es/locale/lang/zh-cn";
import "element-plus/dist/index.css";
// 引入公共样式
import "normalize.css";
// import "@/assets/styles/element-variables.scss";
import "./style.css";
// element plus 图标
import * as ElementPlusIconsVue from "@element-plus/icons-vue";
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}
// 引入v-md-editor
import VueMarkdownEditor from "@kangc/v-md-editor";
import "@kangc/v-md-editor/lib/style/base-editor.css";
import VMdPreview from "@kangc/v-md-editor/lib/preview";
import "@kangc/v-md-editor/lib/style/preview.css";

import githubTheme from "@kangc/v-md-editor/lib/theme/github.js";
import "@kangc/v-md-editor/lib/theme/style/github.css";

import vuepressTheme from "@kangc/v-md-editor/lib/theme/vuepress.js";
import "@kangc/v-md-editor/lib/theme/style/vuepress.css";

import Prism from "prismjs";
import hljs from "highlight.js";

import createEmojiPlugin from "@kangc/v-md-editor/lib/plugins/emoji/index";
import "@kangc/v-md-editor/lib/plugins/emoji/emoji.css";

import createTodoListPlugin from "@kangc/v-md-editor/lib/plugins/todo-list/index";
import "@kangc/v-md-editor/lib/plugins/todo-list/todo-list.css";

import createCopyCodePlugin from "@kangc/v-md-editor/lib/plugins/copy-code/index";
import "@kangc/v-md-editor/lib/plugins/copy-code/copy-code.css";

VueMarkdownEditor.use(vuepressTheme, {
  Prism,
  codeHighlightExtensionMap: {
    vue: "html",
  },
});
VueMarkdownEditor.use(createEmojiPlugin());
VueMarkdownEditor.use(createTodoListPlugin());
VueMarkdownEditor.use(createCopyCodePlugin());
app.use(VueMarkdownEditor);
VMdPreview.use(githubTheme, {
  Hljs: hljs,
  codeHighlightExtensionMap: {
    vue: "html",
  },
});
VMdPreview.use(createEmojiPlugin());
VMdPreview.use(createTodoListPlugin());
VMdPreview.use(createCopyCodePlugin());
app.use(VMdPreview);
app.use(router);
app.use(createPinia());
app.use(ElementPlus, {
  locale: zhCn,
});

import { checkIfNewVersion } from "@/utils/updata";
checkIfNewVersion();
// 全局自定义弹窗
// import searchDialog from "@/components/searchDialog/index";
// app.use(searchDialog);
app.mount("#app");
